<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%collection_result_push}}".
 *
 * @property int $id
 * @property int $task_id
 * @property int $push_at
 * @property string $req_json
 * @property string $fdsf_path
 *
 * @property CollectionTask $task
 */
class CollectionResultPush extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%collection_result_push}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['task_id', 'push_at', 'req_json'], 'required'],
            [['task_id', 'push_at'], 'integer'],
            [['req_json'], 'string'],
            [['fdsf_path'], 'string', 'max' => 150],
            [['task_id'], 'exist', 'skipOnError' => true, 'targetClass' => CollectionTask::className(), 'targetAttribute' => ['task_id' => 'id']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'task_id' => Yii::t('app', 'Task ID'),
            'push_at' => Yii::t('app', 'Push At'),
            'req_json' => Yii::t('app', 'Req Json'),
            'fdsf_path' => Yii::t('app', 'fdsf Path'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTask()
    {
        return $this->hasOne(CollectionTask::className(), ['id' => 'task_id']);
    }
}
